package com.geo.fight;

import java.awt.geom.Rectangle2D;

public class Missile {
	
	/**
	 * @author Geo
	 */
	
	private double xPos;
	private double yPos;
	private int radius = 10;
	private double velo = 2;
	private final int BOUND = 480;
	private boolean visible;
	private double theta;
	
	public Missile(){
		
	}
	public Missile(double xPos,double yPos){
		visible = true;
		this.xPos = xPos;
		this.yPos = yPos;
	}
	public double getxPos() {
		return xPos;
	}
	public void setxPos(double xPos) {
		this.xPos = xPos;
	}
	public double getyPos() {
		return yPos;
	}
	public void setyPos(double yPos) {
		this.yPos = yPos;
	}
	public int getRadius() {
		return radius;
	}
	public void setRadius(int radius) {
		this.radius = radius;
	}
	public double getVelo() {
		return velo;
	}
	public void setVelo(double velo) {
		this.velo = velo;
	}
	
	public void move(){
		
		
		double velox = velo*Math.sin(Math.toRadians(theta)); 
		double veloy = velo*Math.cos(Math.toRadians(theta));
		
		
		xPos = xPos+velox;
		yPos=yPos+veloy;
		
		if(xPos>=BOUND || yPos >=BOUND){
			visible = false;
		}
	}
	public boolean isVisible(){
		return visible;
	}
	public void setVisible(boolean visible){
		this.visible = visible;
	}
	public void setTheta(double theta){
		this.theta = theta;
	}
	
	public Rectangle2D getBounds(){
		return new Rectangle2D.Double(xPos, yPos, radius, radius);
	}
}
